class calculator{
//generating the random array
public static void printn(int[] resl){
int i;
for(i=0;i<resl.length;i++)
System.out.println("array generated is: " + resl[i]);

}

public static int[] generate(int size){
int[] res=new int[size];
for(int i=0;i<res.length;i++){
res[i]=(int)(Math.random()*100);
}
return res;
}


//creating a multidimensional array n add it
public static int[][] addmatrix()
{
	int[][] res2={{1,2},
				  {2,1}};
	int[][] res3={{2,4},
				  {5,1}};
		int[][] sum=new int[2][2];
		for(int i=0;i<res2.length;i++)
		{	for(int j=0;j<res3.length;j++) 
			{	sum[i][j]=res2[i][j]+res3[i][j];
				System.out.println(" addition of matrix " +sum[i][j]);
			}
		}return sum;
		}
		
public static int[][] submatrix()
{
	int[][] res2={{1,2},
				  {2,1}};
	int[][] res3={{2,4},
				  {5,1}};
		int[][] sub=new int[2][2];
		for(int i=0;i<res2.length;i++)
		{	for(int j=0;j<res3.length;j++) 
			{	sub[i][j]=res2[i][j]-res3[i][j];
				System.out.println("sub of matrix " +sub[i][j]);
			}
		}return sub;
		}
		
		

/*public static int[][] result1()
{
	int[][] a=addmatrix();
	for(int i=0;i<a.length;i++)
		{	for(int j=0;j<a.length;j++) 
			{ 
			System.out.println(" addition of matrix " +sum[i][j]);
			System.out.println("sub of matrix " +sub[i][j]);
			}	
	
		
		}
}	*/

	public static int[][] mulmatrix()
{
	int[][] res2={{1,2},
				  {2,1}};
	int[][] res3={{2,4},
				  {5,1}};
		int row=res2.length;
		int col=res3[0].length;
		int[][] mul[i][j]=new int[][];
		for(int i=0;i<row;i++)
		{	for(int j=0;j<col;j++) 
			
			mul[i][j]=0
			{	for(int k=0;i<row;i++);
				mul[i][j]=res2[i][k]*res3[k][j];
				System.out.println("mul of matrix " +mul[i][j]);
			}
		}return sub;
		}	
		

}

$